<?php namespace Common\Model;
use Hdphp\Model\Model;
class GoodsList extends Model{
	protected $table = 'goods_list';
	
	protected $validate = array(
		array('number','required','货号不能为空',3,3),
		array('inventory','required','货品库存不能为空',3,3)
	);
	
	//货品添加
	public function store(){
		if(!$this->create()) return false;
		$gid=Q('get.gid');
//		p(Q("post."));exit;
		$this->data['combine']=implode('|',Q('post.combine'));
		$this->data['goods_gid']=$gid;
		$this->add();
		return true;
	}
	
	//货品编辑
	public function edit(){
		if(!$this->create()) return false;
		$gid=Q('get.gid');
//		p(Q("post."));exit;
		$this->data['combine']=implode('|',Q('post.combine'));
		$this->data['goods_gid']=$gid;
//		p('$this->data');exit;
		$this->save();
		return true;
	}
}
